//
//  CoreWork.m
//  WisdomShope
//
//  Created by mac on 15/12/26.
//  Copyright (c) 2015年 ZY. All rights reserved.
//

#import "CoreWork.h"
#import "RequestWork.h"


@implementation CoreWork


+ (void)getHomeBannerBlock:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/lunbo/lunbo",BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:nil successBackBlock:^(id responsobject) {
        
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        
        block(reponsobject);
    }];
}

#pragma mark 获取当前登录用户的Token
+ (void)getTokenOfCurrentLoginUserBlock:(void(^)(id responsObject))block{
    
    NSString *url = [NSString stringWithFormat:@"%@/api/member/getToken.do",BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:nil successBackBlock:^(id responsobject) {
        
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        
        block(reponsobject);
    }];
}
#pragma mark 登陆
+ (void)normalLoginWithLogintype:(NSString *)logintype signtelephone:(NSString *)signtelephone signpsw:(NSString *)signpsw Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/index/logininfo",BaseUrl];
    NSDictionary *dic = @{@"type":@"0",@"signtelephone":signtelephone,@"signpsw":signpsw};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        
        block(reponsobject);
    }];
}
#pragma mark 注册功能
+ (void)registerUserWithUsername:(NSString *)username password:(NSString *)password code:(NSString *)code Block:(void(^)(id responsObject))block;{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Login/register",BaseUrl];
    NSDictionary *dic = @{@"username":username,@"password":password,@"code":code};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        
        block(reponsobject);
    }];
}
#pragma mark 三方登录
+ (void)thirdQQLoginWithLogintype:(NSString *)logintype signtelphone:(NSString *)signtelphone code:(NSString *)code Block:(void (^)(id))block
{
    
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Login/Login", BaseUrl];
    NSDictionary *dic = @{@"qq_openid":logintype,@"coachtelephone":signtelphone,@"othercode":code};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
    
}

#pragma mark QQ  WeChat Login
+ (void)otherLoginWithDiction:(NSDictionary *)dic Block:(void(^)(id responsObject))block{
    // /coachnew/public/index.php/student/Login/Login
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Login/Login",BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}


#pragma mark 签到
+ (void)signCommingWithSigntelephone:(NSString *)signtelephone Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/qiandao", BaseUrl];
    NSDictionary *dic = @{@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"]};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark 获取科目二视频
+ (void)getVideoOfClsTwoWithStudentID:(NSString *)studentId Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/kemu/kemu2", BaseUrl];
    NSDictionary *dic = @{@"studentid":studentId};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark 获取科目三视频
+ (void)getVideoOfClsThreeWithStudentID:(NSString *)studentId Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/kemu/kemu3", BaseUrl];

    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"]} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 获取驾校详情
+ (void)getSchoolInfoWithschoolid:(NSString *)schoolid signtelephone:(NSString *)signtelephone Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/index/school_detail", BaseUrl];
    NSDictionary *dic = @{@"schoolid":schoolid,@"signtelephone":signtelephone};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark  获取教练详情
// 
+ (void)getCoachDetailInfoWithcoachid:(NSString *)coachid  studentid:(NSString *)studentid  Block:(void (^)(id))block
{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/index/coach_detail", BaseUrl];
    NSDictionary *dic = @{@"coachid":coachid,@"studentid":studentid};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark 获取班型详情
+ (void)getClsTypeInfoWithid:(NSString *)clsId studentId:(NSString *)studentId Block:(void(^)(id responsObject))block{
    
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/index/schoolclass", BaseUrl];
    NSDictionary *dic = @{@"id":clsId,@"studentid":studentId};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
    
}
#pragma mark 咨询接口
+ (void)zixunWithDic:(NSDictionary *)dic Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/zixun", BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 咨询教练
+ (void)zixunCoachWithDic:(NSDictionary *)dic Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/coachzixun", BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];

}
#pragma mark 修改用户信息
+ (void)changeUserInfoWithDic:(NSDictionary *)dic urlheadpic:(UIImage *)urlheadpic Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/User/edituser", BaseUrl];
    [RequestWork changeUserImageUseAFNetWoringWithURL:url parmas:dic imageFileName:@"urlheadpic" image:urlheadpic successBackBlock:^(id responsobject) {
        
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        
        block(reponsobject);
    }];
    
    
}

#pragma mark 意见反馈
+ (void)ideaBackWithDic:(NSDictionary *)dic Block:(void(^)(id responsObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/User/leavemsg", BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark  找驾校
+ (void)foundcarSchoolWithDic:(NSDictionary *)dic Block:(void (^)(id))block
{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/index/school_type", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}


#pragma mark  找教练
+ (void)foundTeacherWithDic:(NSDictionary *)dic Block:(void (^)(id))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/index/coach_type", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
    
}

#pragma mark 获取社区列表
+ (void)getBBSlistWithpage:(NSString *)page type:(NSString *)type pagesize:(NSString *)pagesize Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Bbs/bbslist", BaseUrl];
    NSDictionary *dic = @{@"offset":page,@"page":pagesize,@"type":type};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 社区详情接口
+ (void)getBBSinfoWithID:(NSString *)ID Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Bbs/bbsdetail", BaseUrl];
    NSDictionary *dic = @{@"id":ID,@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"]};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 发布话题
+ (void)upNewCommentWithDic:(NSDictionary *)dic imageArr:(NSArray<UIImage *> *)imageArr Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Bbs/send", BaseUrl];
    [RequestWork upMoreImageURL:url pamars:dic picture:nil imgArr:imageArr successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 评论
+ (void)commentWithDic:(NSDictionary *)dic Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Bbs/comment", BaseUrl];
  
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 点赞
+ (void)zanWithDic:(NSDictionary *)dic Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Bbs/zan", BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 成绩排名
+ (void)scoreRankWithClasstype:(NSString *)classtype signtelephone:(NSString *)signtelephone Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Kemu/scorerank", BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"classtype":classtype,@"signtelephone":signtelephone} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 考试成绩
+ (void)myScoreClasstype:(NSString *)classtype signtelephone:(NSString *)signtelephone Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Kemu/myscore", BaseUrl];
    
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"classtype":classtype,@"signtelephone":signtelephone} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
    
    
}
#pragma mark 评论驾校 评论教练
+ (void)commentSchoolWithschollORcoachid:(NSString *)ID studentid:(NSString *)studentid service:(NSString *)service career:(NSString *)career timeplan:(NSString *)timeplan place:(NSString *)place content:(NSString *)content isSchool:(BOOL)isSchool Block:(void(^)(id responseObject))block{
    NSString *url;
    NSDictionary *dic;
    if (isSchool == YES) {
        url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/kemu/schoolAppraise",BaseUrl];
        dic = @{@"schoolid":ID,@"studentid":studentid,@"service":service,@"career":career,@"timeplan":timeplan,@"place":place,@"content":content};
    }else{
        url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/kemu/coachAppraise",BaseUrl];
        dic = @{@"coachid":ID,@"studentid":studentid,@"service":service,@"career":career,@"timeplan":timeplan,@"place":place,@"content":content};
    }
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark  教练发布的预约练车的接口
+ (void)getJiaolianYuyueLiancheWithStudentID:(NSString *)studentID type:(NSString *)type Block:(void(^)(id responseObject))block
{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Kemu/times", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":studentID,@"type":type} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

#pragma mark 获取我的教练的信息
+ (void)getMycoachLiancheInformationWithStudentId:(NSString *)studentid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/getCoachInfo", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":studentid} successBackBlock:^(id responsobject) {
         block(responsobject);
    } fileBackBlock:^(id reponsobject) {
         block(reponsobject);
    }];
}
#pragma mark 获取消息列表
+ (void)getMsgListBlock:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/Bbs/adminPush", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:nil successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}



#pragma mark 获取我的预约练车接口
+ (void)getMyYuyueLiancheJiekouWithStudentID:(NSString *)studentid typekemu:(NSString *)typekemu Block:(void (^)(id))block
{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/kemu/myDrive", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":studentid,@"type":typekemu} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 获取我的优惠券信息
+ (void)getMyyouhuiquanListWithStudentid:(NSString *)studentid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/User/mycouponid", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":studentid} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 忘记密码
+ (void)backPWDWithDic:(NSDictionary *)dic Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/getPassword", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 获取当前城市下所有的学校
+ (void)getSchollListWithCity:(NSString *)city Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/college", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"city":city} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 绑定学校
+ (void)bindSchollWithSchoolID:(NSString *)schoolID studentid:(NSString *)studentid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/myCollege", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":studentid,@"collegeid":schoolID} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 获取用户绑定的学校
+ (void)getBindSchoolWithStuentid:(NSString *)studentid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/user/getCollege", BaseUrl];
    if (studentid == nil){
        [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":@""} successBackBlock:^(id responsobject) {
            block(responsobject);
        } fileBackBlock:^(id reponsobject) {
            block(reponsobject);
        }];
    }else{
        [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":studentid} successBackBlock:^(id responsobject) {
            block(responsobject);
        } fileBackBlock:^(id reponsobject) {
            block(reponsobject);
        }];
    }
}
#pragma mark 获取我的考试通知
+ (void)getMyExamListBlock:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/kemu/examInfo", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"]} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 购买优惠券
+ (void)buyPreferentWithStudentid:(NSString *)studentid clsID:(NSString *)classid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/pay/testPay", BaseUrl];
    NSDictionary *dic = @{@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"],@"classid":@"37"};
    
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 判断用户是否购买VIP
+ (void)userIsBuyVipWithUserId:(NSString *)userid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/mycar/isVip", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"]} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
    
}
#pragma mark 报名购买VIP
+ (void)buyVIPWithDic:(NSDictionary *)dic Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/pay/vipPay", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 获取预约专车列表
+ (void)getDriveListWithUserId:(NSString *)userID Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/mycar/timeList", BaseUrl];
    [RequestWork POSTOfAFNWithURL:url pamars:@{@"studentid":[[NSUserDefaults standardUserDefaults] objectForKey:@"studentid"]} successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 添加预约专车
+ (void)addDriveInfoWithSutentID:(NSString *)studentid times:(NSString *)times type:(NSString *)type Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/mycar/timeAdd", BaseUrl];
    NSDictionary *dic = @{@"studentid":studentid,@"times":times,@"type":type};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}
#pragma mark 删除预约专车
+ (void)deleteDriveInfoWithID:(NSString *)ID studentid:(NSString *)studentid Block:(void(^)(id responseObject))block{
    NSString *url = [NSString stringWithFormat:@"%@/coachnew/public/index.php/student/mycar/timeDel", BaseUrl];
    NSDictionary *dic = @{@"studentid":studentid,@"id":ID};
    [RequestWork POSTOfAFNWithURL:url pamars:dic successBackBlock:^(id responsobject) {
        block(responsobject);
    } fileBackBlock:^(id reponsobject) {
        block(reponsobject);
    }];
}

@end
